/*
	LinkedList2 is a sub-class of LinkedList.  It contains a single method,
	sort, which sorts the list in ascending order.

	Write the sort method.
*/

public class LinkedList2 extends LinkedList
{
/*ans bl*/
	public void sort()
	{
		if (length() > 1)
		{
			Node start, smallest, cur;
			Comparable temp;

			for (start = _head; start._next != null; start = start._next)
			{
				smallest = start;

				for (cur = start._next; cur != null; cur = cur._next)
					if (cur._data.compareTo(smallest._data) < 0)
						smallest = cur;

				//swap
				temp = smallest._data;
				smallest._data = start._data;
				start._data = temp;

			}

		}
/*ans ab*/


	}




}//end class LinkedList2